<!DOCTYPE html>
<html>

<head>
    <title>{$Think.config.app_name}</title>
    {include file="public/head"/}
    <style>
        input[type=checkbox] {
            opacity: 0;
            display: none !important;
        }

        input[type=checkbox]+label {
            display: inline-block;
            cursor: pointer;
            font-size: 12px;
            border: 1px solid #009688;
            padding: 2px 5px;
            user-select: none;
            -webkit-user-select: none;
        }

        input[type=checkbox]+label::before {
            display: inline-block;
            content: "不生成";
            text-align: center;
            font-size: 12px;
            color: white;
            background: #ccc;
            border: 1px solid #ccc;
            padding: 2px 5px;
            margin: -2px -5px;
            margin-right: 5px;
        }

        input[type=checkbox]:checked+label::before {
            display: inline-block;
            content: "请生成";
            background: #009688;
            border: 1px solid #009688;
        }

        .checkItem {
            position: relative;
            display: inline-block;
            padding: 8px 0px;
            margin-right: 10px;
        }

        .layui-elem-field {
            margin-bottom: 50px;
        }
    </style>
</head>

<body class="layui-layout-body">
    <div id="LAY_app" class="layadmin-tabspage-none">
        <div class="layui-layout layui-layout-admin">
            {include file="public/menu"/}
            <div class="layui-body root_box" v-cloak>
                <fieldset class="layui-elem-field">
                    <legend>系统访问日志清理</legend>
                    <div class="layui-card"
                        style="background-color:#f5f5f5;border:1px solid #ddd;color:#666;font-size:12px;">
                        <div class="layui-card-body">
                            访问日志清理为
                            <font color=orangered>不可逆操作</font>，建议清理前先导出日志记录！
                        </div>
                    </div>
                    <button class="layui-btn layui-btn-danger" type="button" @click="clean_log">清理日志</button>
                </fieldset>
                <fieldset class="layui-elem-field">
                    <legend>用户组授权信息清理</legend>
                    <div class="layui-card"
                        style="background-color:#f5f5f5;border:1px solid #ddd;color:#666;font-size:12px;">
                        <div class="layui-card-body">
                            用户组授权信息清理为
                            <font color=orangered>不可逆操作</font>，请谨慎操作！<br> 清理完毕后，除超级管理用户组外，其他任何用户组将无法访问系统任何功能！
                            <br> 建议仅在用户组权限混乱或出现其他账号安全问题时进行清理操作。
                            <br> 清理成功后可重新对用户组进行权限授权，即可恢复正常使用。
                            <br>
                        </div>
                    </div>
                    <button class="layui-btn layui-btn-danger" type="button" @click="clean_auth">清理授权</button>
                </fieldset>
            </div>
        </div>
    </div>
</body>
{include file="public/foot"/}
<script>
    var app = new Vue({
        el: ".root_box",
        data: {},
        created: function () { },
        methods: {
            clean_log: function () {
                _confirm('是否确认清理全部日志?', '清空警告', function () {
                    _loading("正在清空");
                    $.post("/api/log/clean", PostCommon,
                        function (data, status) {
                            _hideLoading();
                            if (data.code != 200) {
                                _alert(data.msg);
                            } else {
                                _alert('访问日志清理成功');
                            }
                        });
                });
            },
            clean_auth: function () {
                _confirm('是否确认清理全部授权信息?', '清空警告', function () {
                    _loading("正在清空");
                    $.post("/api/auth/clean", PostCommon,
                        function (data, status) {
                            _hideLoading();
                            if (data.code != 200) {
                                _alert(data.msg);
                            } else {
                                _alert('授权信息清理成功');
                            }
                        });
                });
            },
        }
    });
</script>

</html>